package org.jeecg.modules.engineering.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.engineering.entity.EquipEventNoticeType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description: 事件通知类型表
 * @Author: jeecg-boot
 * @Date:   2019-09-28
 * @Version: V1.0
 */
@Repository
public interface EquipEventNoticeTypeMapper extends BaseMapper<EquipEventNoticeType> {

    @Select("SELECT DISTINCT eenu.notice_user_phone FROM equip_event_notice_user eenu \n" +
            "INNER JOIN equip_event_notice_type eent on eenu.notice_type_id = eent.id AND eent.del_flag = 0\n" +
            "WHERE eent.project_id = #{projectId} AND ( eent.event_sort_id = #{eventId} OR eent.warning_level_id = #{warningLevel}) AND eenu.del_flag = 0")
    @SqlParser(filter = true)
    List<String> queryPhoneList(@Param("projectId")String projectId, @Param("eventId")String eventId, @Param("warningLevel")String warningLevel);

    long getCount(@Param("projectId")String projectId, @Param("eventId")String eventId, String id);
}
